package com.dragon8869.myspringboot.mq.consumer;

import com.dragon8869.myspringboot.entity.AyMood;
import com.dragon8869.myspringboot.service.AyMoodService;
import lombok.extern.log4j.Log4j2;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
@Log4j2
public class AyMoodConsumer {

    @JmsListener(destination = "ay.queue")
    public void receiveQueue(String text){
        log.info("用户发表说说【"+text+"】成功");
    }


    @Resource
    AyMoodService ayMoodService;

    @JmsListener(destination = "ay.queue.asyn.save")
    public void receiveQueue(AyMood ayMood){
        ayMoodService.save(ayMood);
        log.info("用户发表ayMood成功:" + ayMood);
    }

}
